package com.hhkj.study.admin.resource.excel;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author luowu
 * @Date 2024/9/19 涵 14:06:49
 */
@Data
public class ResourceCourseVideoExcelRes extends BaseExcelRes {

    /**
     * 名称
     */
    @NotBlank(message = "名称为空或者错误")
    @Excel(name = "名称", width = 20, needMerge = true, require = true)
    private String name;
    /**
     * 视频类型,字典表id
     */
    @NotNull(message = "视频地址为空或者错误")
    @Excel(name = "视频类型", width = 20, needMerge = true, customDictType = "videoTypeCode", require = true)
    private Long type;
    /**
     * 视频url
     */
    @NotBlank(message = "视频地址为空或者错误")
    @Excel(name = "视频地址", width = 20, needMerge = true, require = true)
    private String url;
    /**
     * 讲师
     */
    @Excel(name = "讲师", width = 20, needMerge = true)
    private String teacherName;

    /**
     * 资料名称
     */
    @Excel(name = "资料名称", width = 20, needMerge = true, type = Excel.Type.IMPORT)
    private String docName;

    /**
     * 题库名称
     */
    @Excel(name = "题库名称", width = 20, needMerge = true, type = Excel.Type.IMPORT)
    private String bankName;

    /**
     * 课程类型
     */
    @NotNull(message = "课程小类为空或错误")
    @Excel(name = "课程类型", width = 20, needMerge = true, customDictType = "courseTypeCode", needFilterStr = StrUtil.DASHED, require = true)
    private Long courseType;

    /**
     * 课程类型
     */
    @Excel(name = "章节目录", width = 20, needMerge = true, customDictType = "chapterCatalogCode", require = true)
    private Long chapterCatalog;

    /**
     * 视频大小(m)
     */
    @Excel(name = "视频大小(选填)", width = 20, needMerge = true)
    private Long size;
    /**
     * 视频时长(s)
     */
    @Excel(name = "视频时长(选填)", width = 20, needMerge = true)
    private Long duration;
    /**
     * 资料id,关联x_resource_course_doc表中id
     */
    private Long docId;
    /**
     * 题库id,关联x_resource_question_bank表中id
     */
    private Long bankId;
    /**
     * 年份
     */
    @Excel(name = "年份", width = 20, needMerge = true)
    private String year;
    /**
     * 讲师id,关联x_teacher表中id
     */
    private Long teacherId;
    /**
     * 说明
     */
    @Excel(name = "说明", width = 20, needMerge = true)
    private String remark;
    /**
     * 是否展示（0-上架， 1-下架）
     */
    @Excel(name = "上下架状态", width = 20, needMerge = true, readConverterExp = "0=否,1=是", require = true, combo = {"是","否"})
    private Integer publishedFlag;

    /**
     * 上传时间
     */
    @NotNull(message = "上传时间不能为空")
    @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", require = true)
    private Date uploadTime;
    /**
     * 排序序号
     */
    @Excel(name = "排序", width = 20, needMerge = true)
    private Integer orderNum;

    @Override
    public Long getResourceCourseType() {
        return this.courseType;
    }

    @Override
    public String getTitle() {
        return "视频导入模板\n" +
                "1、表头红色加粗为必填字段\n" +
                "2、时间格式为yyyy-MM-dd HH:mm:ss\n" +
                "3、视频时长和视频大小非必填,如果不填会从视频url解析相关信息,视频大小单位是M,整数型没有小数点,视频时长单位s,整型";
    }

    @Override
    public String getSheetName() {
        return "视频导入模板";
    }
}
